<script setup>
import {reactive} from "vue";
import request from "@/utils/request";

/**
 * 本地存储的账户信息
 *
 * @type {any}
 */
const account = JSON.parse(localStorage.getItem('account-info') || '{}')

/**
 * 学生数据
 *
 * @type {UnwrapNestedRefs<{form: {studentComprehensiveEvaluation: string}}>}
 */
const studentData = reactive({
    form: {
        studentComprehensiveEvaluation: '',
    }
})

/**
 * 加载个人评价
 */
const loadStudent = () => {
    request.get(`/api/student/evaluate-student/${account.accountNo}`).then(res => {
        if (res.code === "200") {
            if (res.data === null) {
                studentData.form.studentComprehensiveEvaluation = {}
            } else {
                studentData.form.studentComprehensiveEvaluation = res.data
            }
        }
    })
}
loadStudent();
</script>

<template>
    <div>
        <div class="card" style="width: 50%; padding: 40px;">
            <el-form :model="studentData.form" label-width="100px" label-position="center"
                     style="padding-right: 40px">
                <el-form-item label="个人评价" prop="studentComprehensiveEvaluation">
                    <el-input
                            v-model="studentData.form.studentComprehensiveEvaluation"
                            :autosize="{ minRows: 8, maxRows: 8 }"
                            type="textarea"
                            placeholder="字数不得超过300字"
                            :maxlength="300"
                            disabled
                    />
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<style scoped>

</style>